package com.wwh.aop.aspectj;

import org.springframework.stereotype.Component;

/**
 * @author Albert
 * @date 2024/8/26-21:42
 * @describe
 */
@Component//当Spring容器启动时，该类会被注入到容器中
public class Calculator implements SmartAnimal {

    @Override
    public int getSum(int num1, int num2) {
        int res = num1 + num2;
        //try {
        //    int i = 1 / 0;
        //} catch (Exception e) {
        //    throw new RuntimeException(e);
        //}
        System.out.println("getSum方法内部打印result = " + res);
        return res;
    }

    @Override
    public int getSub(int num1, int num2) {
        int res = num1 - num2;
        System.out.println("getSub方法内部打印result = " + res);
        return res;
    }
}
